package com.zj.guava.eventbus.DirectoryAndFileWatch;

import com.google.common.eventbus.EventBus;

import java.io.IOException;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class Test {

    @org.junit.Test
    public void testMonitro() throws IOException {
        EventBus bus = new EventBus();
        String directory = "/home/alex/IdeaProjects/guava/directory/";
        DirectoryMonitor monitor = new DirectoryMonitor(bus, directory);

        Executors.newSingleThreadScheduledExecutor().schedule(() -> {
            try {
                monitor.storMonitor();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }, 100, TimeUnit.SECONDS);
        monitor.startMonitor();

    }
}
